<?php

namespace app\admin\command;

use think\console\Command;
use think\console\Input;
use think\console\Output;
use think\Loader;

class GenerateMenuLangKeys extends Command
{
    protected function configure()
    {
        $this->setName('generatemenukeys')
            ->setDescription('Generate language keys for menu titles');
    }

    protected function execute(Input $input, Output $output)
    {
        // 中文菜单标题到英文的映射
        $menuMapping = [
            '进销存管理' => 'Kuerp Management',
            '数据面板' => 'Data Dashboard',
            '打印' => 'Print',
            '购货2' => 'Purchase',
            '购货订单' => 'Purchase Order',
            '查看' => 'View',
            '添加' => 'Add',
            '编辑' => 'Edit',
            '删除' => 'Delete',
            '审核/反审核' => 'Approve/Unapprove',
            '合并入库' => 'Merge Stock In',
            '内置函数' => 'Internal Function',
            '对单/反对单' => 'Check/Uncheck',
            '获取单位价格' => 'Get Unit Price',
            '获取可用序列号' => 'Get Available Serial Numbers',
            '批量更新' => 'Batch Update',
            '导入' => 'Import',
            '购货单' => 'Purchase Order Form',
            '购货退货单' => 'Purchase Return Order',
            '采购明细表' => 'Purchase Details',
            '采购订单跟踪表' => 'Purchase Order Tracking',
            '采购汇总表(商品)' => 'Purchase Summary (Products)',
            '采购汇总表(供应商)' => 'Purchase Summary (Suppliers)',
            '采购付款一览表' => 'Purchase Payment Overview',
            '采购开票管理' => 'Purchase Invoice Management',
            '开票' => 'Invoice',
            '以销定购看板' => 'Sales-Based Purchase Board',
            '智能补货' => 'Smart Replenishment',
            '原始单据' => 'Original Documents',
            '选择' => 'Select',
            '销货' => 'Sales',
            '销货订单' => 'Sales Order',
            '销货单' => 'Sales Order Form',
            '销货退货单' => 'Sales Return Order',
            '销售订单跟踪表' => 'Sales Order Tracking',
            '商品销售明细' => 'Product Sales Details',
            '销货开票管理' => 'Sales Invoice Management',
            '销货收款一览表' => 'Sales Collection Overview',
            '销售汇总表(按商品)' => 'Sales Summary (By Product)',
            '销售汇总表(按客户)' => 'Sales Summary (By Customer)',
            '销售汇总表(按销售员)' => 'Sales Summary (By Salesperson)',
            '销售利润表' => 'Sales Profit Statement',
            '销售排行表' => 'Sales Ranking',
            '往来单位欠款表' => 'Business Unit Arrears',
            '零售' => 'Retail',
            '零售单' => 'Retail Order',
            '收银台' => 'Cashier',
            '收银台商品列表' => 'Cashier Product List',
            '零售退货单' => 'Retail Return Order',
            '仓库' => 'Warehouse',
            '调拨单' => 'Transfer Order',
            '成本调整单' => 'Cost Adjustment Order',
            '盘点' => 'Inventory Check',
            '导出' => 'Export',
            '序列号盘点' => 'Serial Number Inventory',
            '其他入库单' => 'Other Stock In Order',
            '其他出库单' => 'Other Stock Out Order',
            '组装单' => 'Assembly Order',
            '拆卸单' => 'Disassembly Order',
            '库存预警' => 'Stock Warning',
            '商品库存余额表' => 'Product Stock Balance',
            '批次跟踪表' => 'Batch Tracking',
            '商品收发明细表' => 'Product Receipt and Issue Details',
            '商品收发汇总表' => 'Product Receipt and Issue Summary',
            '序列号跟踪表' => 'Serial Number Tracking',
            '序列号状态表' => 'Serial Number Status',
            '批次保质期清单' => 'Batch Expiry List',
            '模板列表' => 'Template List',
            '获取模板' => 'Get Template',
            '拆卸单模板' => 'Disassembly Order Template',
            '资金' => 'Capital',
            '付款单' => 'Payment Order',
            '收款单' => 'Collection Order',
            '核销单' => 'Write-off Order',
            '应收账款明细表' => 'Accounts Receivable Details',
            '应付账款明细表' => 'Accounts Payable Details',
            '其他收入单' => 'Other Income Order',
            '采购销售费用清单' => 'Purchase and Sales Expense List',
            '组合采购销售费用' => 'Combine Purchase and Sales Expenses',
            '其他支出单' => 'Other Expense Order',
            '资金转账单' => 'Fund Transfer Order',
            '现金银行报表' => 'Cash and Bank Statement',
            '客户对账单' => 'Customer Statement',
            '供应商对账单' => 'Supplier Statement',
            '其他收支明细表' => 'Other Income and Expense Details',
            '利润表' => 'Profit Statement',
            '资料' => 'Data',
            '客户列表' => 'Customer List',
            '供应商管理' => 'Supplier Management',
            '供应商列表' => 'Supplier List',
            '供应商分类' => 'Supplier Category',
            '账户管理' => 'Account Management',
            '商品管理' => 'Product Management',
            '仓库管理' => 'Warehouse Management',
            '职员管理' => 'Staff Management',
            '自取地址管理' => 'Pickup Address Management',
            '司机管理' => 'Driver Management',
            '辅助资料' => 'Auxiliary Data',
            '客户等级' => 'Customer Level',
            '客户分类' => 'Customer Category',
            '商品分类' => 'Product Category',
            '支出类别管理' => 'Expense Category Management',
            '收入类别管理' => 'Income Category Management',
            '结算方式' => 'Settlement Method',
            '单计量单位' => 'Single Unit of Measure',
            '多计量单位' => 'Multiple Units of Measure',
            '商品辅助属性' => 'Product Auxiliary Attributes',
            '客户物料编码' => 'Customer Material Code',
            '设置' => 'Settings',
            '系统参数' => 'System Parameters',
            '系统初始化' => 'System Initialization',
            '初始化' => 'Initialize',
            '结账/反结账' => 'Close/Reopen Accounts',
            '结账' => 'Close Accounts',
            '反结账' => 'Reopen Accounts',
            '三方账号管理' => 'Third-party Account Management',
            '订货通' => 'Order System',
            '轮播管理' => 'Banner Management',
            '订货单管理' => 'Order Management',
            '发货' => 'Ship',
            '系统配置' => 'System Configuration',
            '查看/更新配置' => 'View/Update Configuration',
            '用户管理' => 'User Management',
            '状态切换' => 'Status Toggle',
            '下拉列表' => 'Dropdown List',
            '查询' => 'Query'
        ];

        // 生成语言键映射
        $langKeys = [];
        foreach ($menuMapping as $chinese => $english) {
            // 将英文标题转换为语言键格式（大写+下划线）
            $langKey = strtoupper(str_replace([' ', '/', '(', ')', '-', ','], ['_', '_', '_', '_', '_', '_'], $english));
            $langKeys[$chinese] = $langKey;
        }

        // 输出语言键映射
        foreach ($langKeys as $chinese => $langKey) {
            $output->writeln("'{$chinese}' => '{$langKey}',");
        }
    }
}